/*
 ============================================================================
 Name        : Validator.c
 Author      : SOogle
 Version     : 1.0
 Copyright   : All rights reserved
 Description : FUSELAGE - FUSE FAT32 FILE SYSTEM
 ============================================================================
 */

#include "../../headers/GlobalHeader.h"

int validoMedianteRegex(char* textoParaValidar, char * pattern){
	regex_t    preg;
	//char       *pattern = "^ale";
	int        rc;
	size_t     nmatch = 2;
	regmatch_t pmatch[2];

	if (0 != (rc = regcomp(&preg, pattern, REG_EXTENDED))) {
		printf("regcomp() failed, returning nonzero (%d)\n", rc);
		exit(EXIT_FAILURE);
	}

	rc = regexec(&preg, textoParaValidar, nmatch, pmatch, 0);

	regfree(&preg);

	return rc;
}
